#include <string.h>

void strreplace(const char *res, const char *from, const char *to, char *buff)
{
	const char *tmp;
	char *tmp2;
	int from_len;
	int to_len;

	from_len = strlen(from);
	to_len = strlen(to);

	tmp = res;
	tmp2 = buff;
	while( 1)
	{
		if ( !tmp || !*tmp )
			break;

		if (!strncmp(from, tmp , from_len) )
		{
			strcat(buff, to);
			tmp ++;
			tmp2 += to_len;
			continue;
		}
		*tmp2 = *tmp;
		tmp++;
		tmp2++;
	}
	*tmp2 = 0;
}